<extend name="./app/Tpl/Public/template.html" />
<block name="content_body">
	<div class="pad-lr-10">
	    <div style="padding:10px; overflow:hidden;">
	    	<div class="main_top" style="clear:both;"><h4>温馨提示：</h4>
    			<ul>
    				<li class="green">1.团购商品添加</li>
    			</ul>
	    	</div>
	    </div>
	    <form name="form_edit" id="form_edit" action="{:U('doAdd')}" method="post">
	        <table width="100%" cellpadding="2" cellspacing="1" class="table_form">
	        	<tr>
	        		<th width="100"><span class="required">*</span>商品分类:</th>
	                <td width="300">
					<select name="cate_code" style="width:250px;" class="chosen_search">
	             		<volist name="cateTree" id="val_1">
	             			<optgroup label="{$val_1.code}-{$val_1.title}">
	   						<volist name="val_1['children']" id="val_2">
								<option value="{$val_2.code}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$val_2.code}{$val_2.title}</option>								
							</volist>
							</optgroup>
	             		</volist>
					</select>
	                </td>
	                <td><div id="cate_codeTip"></div></td>

				</tr>     
	            <tr>
	                <th width="100"><span class="required">*</span>条形码:</th>
	                <td width="300">
	                	<input type="text" name="barcode" id="barcode" class="input-text-long" value="">
	                </td>
	                <td><div id="barcodeTip"></div></td>
	            </tr>	            
	            <tr>
	                <th><span class="required">*</span>商品短名称:</th>
	                <td>
	                	<input type="text" name="name" id="name" class="input-text-long" value="">
	                </td>
	                <td><div id="nameTip"></div></td>
	            </tr>
	            <tr>
	                <th><span class="required">*</span>商品长名称:</th>
	                <td>
	                	<input type="text" name="title" id="title" class="input-text-long" value="">
	                </td>
	                <td><div id="titleTip"></div></td>
	            </tr>	         
	            <tr>
	                <th><span class="required">*</span>销售价格:</th>
	                <td>
	                	<input type="text" name="price_real" id="price_real" class="input-text" value="">
	                </td>
	                <td><div id="price_realTip"></div></td>
	            </tr>
	            <tr>
	                <th><span class="required">*</span>推荐价格:</th>
	                <td>
	                	<input type="text" name="price_sale" id="price_sale" class="input-text" value="">
	                </td>
	                <td><div id="price_saleTip"></div></td>
	            </tr>
	            <tr>
	                <th><span class="required">*</span>进货价格:</th>
	                <td>
	                	<input type="text" name="price_buy" id="price_buy" class="input-text" value="">
	                </td>
	                <td><div id="price_buyTip"></div></td>
	            </tr>	          
	            <tr>
	                <th><span class="required">*</span>规格:</th>
	                <td>
	                	<input type="text" name="spec" id="spec" class="input-text" value="">
	                </td>
	                <td><div id="specTip"></div></td>
	            </tr>
	            <tr>
	                <th><span class="required">*</span>规格数量:</th>
	                <td>
	                	<input type="text" name="spec_qty" id="spec_qty" class="input-text" value="1">
	                </td>
	                <td><div id="spec_qtyTip"></div></td>
	            </tr>
	            <tr>
	                <th><span class="required">*</span>规格单位:</th>
	                <td>
	                	<input type="text" name="spec_unit" id="spec_unit" class="input-text" value="">
	                </td>
	                <td><div id="spec_unitTip"></div></td>
	            </tr>	            
	            <tr>
	                <th><span class="required">*</span>库存数量:</th>
	                <td>
	                	<input type="text" name="stock_qty" id="stock_qty" class="input-text" value="">
	                </td>
	                <td><div id="stock_qtyTip"></div></td>
	            </tr>
	            <tr>
	                <th><span class="required">*</span>销售开始日期:</th>
	                <td>
	                	<input type="text" name="start_date" id="start_date" class="input-text" value="">
	                </td>
	                <td><div id="start_dateTip"></div></td>
	            </tr>
	            <tr>
	                <th><span class="required">*</span>销售截至日期:</th>
	                <td>
	                	<input type="text" name="end_date" id="end_date" class="input-text" value="">
	                </td>
	                <td><div id="end_dateTip"></div></td>
	            </tr>		            		            	            	            		            	
	            <tr>
		            <td colspan="3">
			            <div class="explain-col">
			            	<input type="button" name="submitBtn" value="创建" onclick="doSubmit()">
	        				<input type="button" name="reset" value="返回列表" onclick='redirect("{:U('index')}")'>
			        	</div>
		            </td>
	            </tr>
	        </table>
	    </form>
	</div>
<script type="text/javascript" src="__ROOT__/statics/scripts/kindeditor/kindeditor-all-min.js"></script>
<script type="text/javascript">

function doSubmit(){
	$('#form_edit').submit();
}
$(function(){
	
	$.formValidator.initConfig({
		formID:"form_edit",
		wideWord:false,
		submitOnce:true
	});
	
	var tips = {
		"nameTip":"请输入商品短名称",
		"titleTip":"请输入商品长名称",
		"price_realTip":"请输入商品实际销售价格",
		"price_saleTip":"请输入商品建议销售价格",
		"specTip":"请输入商品规格",
		"spec_qtyTip":"请输入规格数量",
		"spec_unitTip":"请输入规格单位",
		"stock_qtyTip":"请输入库存数量"
	}
	$("#name").formValidator({
		onFocus:tips.nameTip,
	}).inputValidator({
		min:2,
		max:50,
		onError:"请输入2-50个汉字或字符"
	})
	$("#title").formValidator({
		onFocus:tips.titleTip,
	}).inputValidator({
		min:2,
		max:50,
		onError:"请输入2-50个汉字或字符"
	})
	
	$("#spec").formValidator({
		onFocus:tips.specTip,
	}).inputValidator({
		min:1,
		max:50,
		onError:"请输入2-50个汉字或字符"
	})

	$("#spec_unit").formValidator({
		onFocus:tips.spec_unitTip,
	}).inputValidator({
		min:1,
		max:50,
		onError:"请输入2-50个汉字或字符"
	})

		
})

</script>
</block>	